package twoPointers;

//https://leetcode.cn/problems/move-zeroes/description/
public class l_283 {
    public void moveZeroes(int[] nums) {
        int cur = 0, dest = -1;
        for(; cur < nums.length; ++cur) {
            if(nums[cur] != 0) {
                ++dest;
                //传统交换, 当dest==cur时不能用异或
                int tmp = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmp;
            }
        }
    }
}
